package com.eshin.demo.custom;

import ch.qos.logback.core.rolling.RollingFileAppender;

public class CustomAppender<E> extends RollingFileAppender<E> {

	ILogCustomAppend logCustomAppend = new DefaultLogCustomAppend();
	
	public ILogCustomAppend getLogCustomAppend() {
		return logCustomAppend;
	}

	public void setLogCustomAppend(ILogCustomAppend logCustomAppend) {
		this.logCustomAppend = logCustomAppend;
	}

	public CustomAppender() {
	}
	
	@Override
	public void start() {
		CustomConverter.keywordsMap.putAll(logCustomAppend.getCustomKeywordsMap());
		super.start();
	}
	
	
	@Override
	protected void subAppend(E event) {
		String appendStr = logCustomAppend.customMessageAppend();
		System.out.println("com.eshin.demo.custom.CustomAppender.subAppend(E): "+appendStr);
		super.subAppend(event);
	}
}
